﻿@model IEnumerable<QBZ.Evaluation.Models.UserModel>
@using QBZ.Evaluation.Domains.Permissions;
@using QBZ.Evaluation.Models;
@inject IAuthorizationService AuthorizationService
@{
    ViewData["Title"] = "用户列表";
}
<h2>@ViewData["Title"]</h2>
@if ((await AuthorizationService.AuthorizeAsync(User, null, new PermissionAuthorizationRequirement(UserLevel.superAdmin))).Succeeded)
{
    <p>
        <a asp-action="Create">创建</a>
    </p>
}
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.UserId)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.UserName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.UserEmail)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.UserNick)
            </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.UserId)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UserName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UserEmail)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.UserNick)
                </td>
                <td>
                    <a asp-action="Edit" asp-route-id="@item.UserId">编辑</a> |
                    <a asp-action="Details" asp-route-id="@item.UserId">详细</a> |
                    <a asp-action="Delete" asp-route-id="@item.UserId">删除</a>
                </td>
            </tr>
        }
    </tbody>
</table>
